Skip to content

fix: Add WebKit FairPlay DRM fallback for AirPlay on newer OS versions#1277

Merged
cjpillsbury merged 14 commits intomuxinc:mainfrom
spuppo-mux:fix/add_fairplay_drm_webkit_fallback
Feb 26, 2026
Merged

fix: Add WebKit FairPlay DRM fallback for AirPlay on newer OS versions#1277
cjpillsbury merged 14 commits intomuxinc:mainfrom
spuppo-mux:fix/add_fairplay_drm_webkit_fallback

Conversation

@spuppo-mux
Copy link
Contributor

@spuppo-mux spuppo-mux commented Feb 18, 2026

Fixes #1261

This PR addresses a bug in Apple devices on newer OS versions when attempting to cast protected media using AirPlay. If the sending device is on OS version 26.1 or 26.2, playback will fail if when casting because of a NotSupportedError on session.generateRequest call.

Summary

  • Extracted EME FairPlay DRM logic from index.ts into eme-fairplay.ts module.
  • Added webkit-fairplay.ts, a legacy FairPlay implementation using WebKit-prefixed APIs (WebKitMediaKeys, webkitneedkey, etc) to work around bug.
  • Added fallback mechanism on DRM setup:
    • when EME session.generateRequest fails with NotSupportedError during AirPlay, the player tears down the EME session and re-initializes using the legacy WebKit FairPlay setup.
  • To work around having to teardown and initialize the core, we now store the PlaybackCore reference in muxMediaState (and get it via new getCoreReference()).
    • Refactored mux-video and mux-audio to derive #core from muxMediaState instead of owning it as a private field, ensuring they always see the latest core after a DRM fallback re-initialization.

New module: eme-fairplay.ts

  • Contains setupEmeNativeFairplayDRM() the standard EME-based FairPlay flow (previously inlined in index.ts).
  • Main changes done to this function (did them in different commits to visualize them more clearly):
    • Added comments detailing steps and setups, and reorganized code to follow the order of those steps
    • Returns a cleanup function (and uses that same function on teardown)
    • Catches NotSupportedError on session.generateRequest during wireless playback and triggers fallbackToWebkitFairplay()

New module: webkit-fairplay.ts

  • Contains setupWebkitNativeFairplayDRM(), the legacy WebKit-prefixed FairPlay flow
  • Mirrors (as close as possible) the EME flow structure but uses WebKitMediaKeys, webkitneedkey, webkitkeymessage, and webkitkeyerror events

Changes in index.ts

  • setupNativeFairplayDRM() now branches between EME and WebKit paths based on internal props.useWebkitFairplay
  • Shared config (certificate/license fetching, error handling, DRM type callback) is extracted into commonConfig
    fallbackToWebkitFairplay callback on initialize() tears down, sets useWebkitFairplay = true, re-initializes, then restores playback position and state
  • coreReference added to muxMediaState so components always get the current core

Changes in mux-video / mux-audio

  • #core changed from a stored field to a getter that reads from getCoreReference(this.nativeEl), keeping it in sync after fallback re-initialization

@vercel
Copy link

vercel bot commented Feb 18, 2026

@spuppo-mux is attempting to deploy a commit to the Mux Team on Vercel.

A member of the Team first needs to authorize it.

@snyk-io
Copy link

snyk-io bot commented Feb 18, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@spuppo-mux spuppo-mux changed the title fix: add fairplay drm webkit fallback fix: Add WebKit FairPlay DRM fallback for AirPlay on newer OS versions Feb 19, 2026
@spuppo-mux spuppo-mux marked this pull request as ready for review February 19, 2026 19:26
@spuppo-mux spuppo-mux requested a review from a team as a code owner February 19, 2026 19:26
Copy link
Contributor

@cjpillsbury cjpillsbury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of minor callouts to fix/respond to, but this is looking great!

Copy link
Contributor

@cjpillsbury cjpillsbury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 🎉

@vercel
Copy link

vercel bot commented Feb 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
elements-demo-astro Ready Ready Preview, Comment Feb 26, 2026 6:48pm
elements-demo-nextjs Error Error Feb 26, 2026 6:48pm
elements-demo-svelte-kit Ready Ready Preview, Comment Feb 26, 2026 6:48pm
elements-demo-vanilla Ready Ready Preview, Comment Feb 26, 2026 6:48pm
elements-demo-vue Ready Ready Preview, Comment Feb 26, 2026 6:48pm

Request Review

@cjpillsbury cjpillsbury merged commit f283080 into muxinc:main Feb 26, 2026
9 of 11 checks passed
@github-actions github-actions bot mentioned this pull request Feb 26, 2026
cjpillsbury pushed a commit that referenced this pull request Feb 26, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>@mux/mux-player: 3.11.5</summary>

##
[3.11.5](https://github.com/muxinc/elements/compare/@mux/[email protected]...@mux/[email protected])
(2026-02-26)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @mux/mux-video bumped from 0.30.2 to 0.30.3
    * @mux/playback-core bumped from 0.33.1 to 0.33.2
</details>

<details><summary>@mux/mux-player-astro: 3.11.5</summary>

##
[3.11.5](https://github.com/muxinc/elements/compare/@mux/[email protected]...@mux/[email protected])
(2026-02-26)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @mux/mux-player bumped from 3.11.4 to 3.11.5
    * @mux/playback-core bumped from 0.33.1 to 0.33.2
</details>

<details><summary>@mux/mux-player-react: 3.11.5</summary>

##
[3.11.5](https://github.com/muxinc/elements/compare/@mux/[email protected]...@mux/[email protected])
(2026-02-26)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @mux/mux-player bumped from 3.11.4 to 3.11.5
    * @mux/playback-core bumped from 0.33.1 to 0.33.2
</details>

<details><summary>@mux/playback-core: 0.33.2</summary>

##
[0.33.2](https://github.com/muxinc/elements/compare/@mux/[email protected]...@mux/[email protected])
(2026-02-26)


### Bug Fixes

* **core:** Add WebKit FairPlay DRM fallback for AirPlay on newer OS
versions ([#1277](#1277))
([f283080](f283080))
</details>

<details><summary>@mux/mux-audio: 0.15.22</summary>

##
[0.15.22](https://github.com/muxinc/elements/compare/@mux/[email protected]...@mux/[email protected])
(2026-02-26)


### Bug Fixes

* **core:** Add WebKit FairPlay DRM fallback for AirPlay on newer OS
versions ([#1277](#1277))
([f283080](f283080))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @mux/playback-core bumped from 0.33.1 to 0.33.2
</details>

<details><summary>@mux/mux-audio-react: 0.15.22</summary>

##
[0.15.22](https://github.com/muxinc/elements/compare/@mux/[email protected]...@mux/[email protected])
(2026-02-26)


### Miscellaneous Chores

* **@mux/mux-audio-react:** Synchronize audio versions


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @mux/playback-core bumped from 0.33.1 to 0.33.2
</details>

<details><summary>@mux/mux-video: 0.30.3</summary>

##
[0.30.3](https://github.com/muxinc/elements/compare/@mux/[email protected]...@mux/[email protected])
(2026-02-26)


### Bug Fixes

* **core:** Add WebKit FairPlay DRM fallback for AirPlay on newer OS
versions ([#1277](#1277))
([f283080](f283080))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @mux/playback-core bumped from 0.33.1 to 0.33.2
</details>

<details><summary>@mux/mux-video-react: 0.30.3</summary>

##
[0.30.3](https://github.com/muxinc/elements/compare/@mux/[email protected]...@mux/[email protected])
(2026-02-26)


### Miscellaneous Chores

* **@mux/mux-video-react:** Synchronize video versions


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @mux/playback-core bumped from 0.33.1 to 0.33.2
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Mux Player DRM AirPlay failure on iOS 26.1+

3 participants